home *** CD-ROM | disk | FTP | other *** search
-
-
- #include "GraphicsModule_Types.h"
- #include "Sounds.h"
-
- #include "blot.h"
- #include "utils.h"
-
- // these are the functs that need defined ...
- OSErr DoInitialize(Handle *storage, RgnHandle blankRgn, GMParamBlockPtr params);
- OSErr DoClose(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
- OSErr DoBlank(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
- OSErr DoDrawFrame(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
- OSErr DoSetUp(RgnHandle blankRgn, short message, GMParamBlockPtr params);
- // these must be defined also
- OSErr DoSelected(RgnHandle blankRgn, short message, GMParamBlockPtr params);
- OSErr DoAboutBox(RgnHandle blankRgn, short message, GMParamBlockPtr params);
-
- extern short gTimeout;
- extern Boolean gXsym, gYsym;
- extern short gMaxpoints, gOffset;
-
- #define ABOUT_PICT 1024
-
- //////////////////////////////////////////////////////////////////////////////////////
- // this is the first funct called by AD ... we need to allocate and initialize here
- OSErr
- DoInitialize(Handle *storage, RgnHandle blankRgn, GMParamBlockPtr params) {
- int i;
-
- gMaxpoints = (10 + params->controlValues[2] ) * 10;
- if (gMaxpoints > MAXPOINTS) gMaxpoints = MAXPOINTS;
-
- gOffset = 1 + (params->controlValues[0] / 10);
-
-
- for (i=0; i<params->monitors->monitorCount; i++)
- initblot( i, &(params->monitors->monitorList[i].bounds),
- params->monitors->monitorList[i].curDepth );
-
- return noErr;
- }
-
- //////////////////////////////////////////////////////////////////////////////////////
- // the screen saver has been awakened! time to ditch the storage and wave goodbye
- OSErr
- DoClose(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params) {
-
-
- return noErr;
- }
-
-
-
- //////////////////////////////////////////////////////////////////////////////////////
- // make the screen go black
- OSErr
- DoBlank(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params) {
-
- // darken the screen ...
- // FillRgn(blankRgn, params->qdGlobalsCopy->qdBlack);
- return noErr;
-
- }
-
- //////////////////////////////////////////////////////////////////////////////////////
- // this is the workhorse routine. It does the continual screen work to make
- // this screen saver what it is.
- OSErr
- DoDrawFrame(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params)
- {
- static currentScreen = 0;
-
-
- if (params->controlValues[1] == 1) // often
- gTimeout = 5;
- else if (params->controlValues[1] == 2) // normal
- gTimeout = 30;
- else if (params->controlValues[1] == 3) // never
- gTimeout = 0;
-
- gXsym = (params->controlValues[3] == 1 || params->controlValues[3] == 3);
- gYsym = (params->controlValues[3] == 2 || params->controlValues[3] == 3);
-
- gOffset = 1 + (params->controlValues[0] / 10);
-
- gMaxpoints = (10 + params->controlValues[2] ) * 10;
- if (gMaxpoints > MAXPOINTS) gMaxpoints = MAXPOINTS;
-
-
- if (currentScreen >= params->monitors->monitorCount)
- currentScreen = 0;
-
- drawblot( currentScreen,
- &(params->monitors->monitorList[currentScreen].bounds),
- params->monitors->monitorList[currentScreen].curDepth);
-
- currentScreen++;
-
- return noErr;
- }
-
- //////////////////////////////////////////////////////////////////////////////////////
- // this is called when they click on something in the control panel
- OSErr
- DoSetUp(RgnHandle blankRgn, short message, GMParamBlockPtr params) {
- // button got pushed??
- return noErr;
- }
-
-
-
- OSErr DoSelected(RgnHandle blankRgn, short message, GMParamBlockPtr params) {
- return noErr;
- }
-
-
-
- OSErr DoAboutBox(RgnHandle blankRgn, short message, GMParamBlockPtr params) {
- GrafPtr savePort;
- short pixelSize;
- PicHandle pictH;
-
-
- gTimeout = 20;
- gXsym = TRUE; // randomize these?
- gYsym = FALSE;
- gMaxpoints = 1000;
- gOffset = 4;
-
- GetPort( &savePort);
-
- if (HasColorQD())
- pixelSize = ( *((CGrafPtr)savePort)->portPixMap)->pixelSize;
- else
- pixelSize = 1;
-
- ////////////////// do the animation /////////////////////////////
- initblot( 0, &(savePort->portRect), pixelSize);
-
- while (!Button())
- drawblot( 0, &(savePort->portRect), pixelSize);
-
- BackColor(blackColor);
- EraseRect( &(savePort->portRect) );
-
- ///////////////// do the picture ///////////////////////////////
- pictH = GetPicture(ABOUT_PICT);
- if (pictH == NULL)
- SysBeep(0);
- else {
- long waste;
-
- DrawPicture( pictH, &(*pictH)->picFrame);
- ReleaseResource( (Handle)pictH);
- Delay( 30, &waste);
- }
- while (!Button())
- ;
- while (StillDown())
- ;
- FlushEvents(everyEvent, 0); // this is for Darkside
-
- return noErr;
- }
-
-
-